package com.ctsi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ctsi.common.util.Search;
import com.ctsi.core.common.util.StringUtil;
import com.ctsi.core.database.util.PageUtil;
import com.ctsi.system.entity.SmsSysTpl;
import com.ctsi.system.mapper.SmsTplMapper;
import com.ctsi.system.service.ISmsTplService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * smstpl 服务实现类
 * </p>
 *
 * @author fxd
 * @date 2022-03-16 10:18:50
 */
@Service
public class SmsTplServiceImpl extends ServiceImpl<SmsTplMapper, SmsSysTpl> implements ISmsTplService {

	@Override
	public IPage<SmsSysTpl> listPage(Search search) {
		LambdaQueryWrapper<SmsSysTpl> queryWrapper = Wrappers.lambdaQuery();
		if (StringUtil.isNotBlank(search.getKeyword())) {
			queryWrapper.like(SmsSysTpl::getId, search.getKeyword());
		}
		queryWrapper.orderByDesc(SmsSysTpl::getCreateTime);
		return this.baseMapper.selectPage(PageUtil.getPage(search), queryWrapper);
	}
}
